package seqList.LeetCode;
//LeetCode 剑指Offer 22题  链表中倒数第K个节点
public class Offer_22 {
    public ListNode getKthFromEnd(ListNode head, int k) {
        ListNode fast = head;
        ListNode low = head;
        //让fast先走k步
        for (int i = 0; i < k; i++) {
            fast = fast.next;
        }
        //一起遍历
        while (fast != null){
            low = low.next;
            fast = fast.next;
        }
        return low;
    }
}
